On Repairing Ill-Typed Expressions

نویسندگان

  • Tihomir Gvero
  • Ivan Kuraj
  • Ruzica Piskac
چکیده

When developing code, a programmer typically knows the approximate structure of the desired expression. However, often the first attempt at writing it down results in an ill-typed code fragment. We propose an approach that automatically repairs code expressions based on the provided almost-correct code. Such a code repair can be applied in interactive scenarios like advanced code completion, as well as in automated repair in the compilation process. We formally define the problem of automatically repairing ill-typed expressions. For the certain class of problems we describe a polynomial time synthesis algorithm that returns the best well-typed expression corresponding to the given ill-typed expression. We also present a complete algorithm that takes as input an ill-typed expression and returns the desired number of type-correct expressions that are closest to the input expression. We simultaneously fix all the type errors in the expression.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Functional genetic programming and exhaustive program search with combinator expressions

Using a strongly typed functional programming language for genetic programming has many advantages, but evolving functional programs with variables requires complex genetic operators with special cases to avoid creating ill-formed programs. We introduce combinator expressions as an alternative program representation for genetic programming, providing the same expressive power as strongly typed ...

متن کامل

Relative Expressiveness of Typed and Untyped Relational Algebra

We consider relational databases with typed attributes and are interested in relational algebra expressions which always result in a relation of some xed type. Such expressions are called \type-safe". Type-safety is undecidable. We also consider \typed" relational algebra expressions, which are syntactically guaranteed to be type-safe. We then show that every expression is equivalent to a union...

متن کامل

A Typeful Integration of SQL into Curry

We present an extension of the declarative programming language Curry to support the access to data stored in relational databases via SQL. Since Curry is statically typed, our emphasis on this SQL integration is on type safety. Our extension respects the type system of Curry so that run-time errors due to ill-typed data are avoided. This is obtained by preprocessing SQL statements at compile t...

متن کامل

Reasoning about Contextual Equivalence: From Untyped to Polymorphically Typed Calculi

This paper describes a syntactical method for contextual equivalence in polymorphically typed lambda-calculi. Our specific calculus has letrec as cyclic let, data constructors, case-expressions, seq, and recursive types. The typed language is a subset of the untyped language. Normal-order reduction is defined for the untyped language. Since there are less typed contexts the typed contextual pre...

متن کامل

Repairing type errors in functional programs

Type systems for programming languages can be used by compilers to reject programs which are found to be potentially unsound and which may, therefore, fail to execute successfully. When a program is rejected the programmer must repair it so that it can be type-checked correctly and then executed safely. Diagnostic error messages are essential to help the programmer repair the program. Hindley-M...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013